package leecode.stringAndArray.String;

public class longestCommonPrefixSolution3 {


    public String solution3(String[] strs){
        if (strs.length==0 || strs==null){
            return "";
        }
        int length = strs[0].length();
        int count = strs.length;
        for (int i = 0; i < length; i++) {
            for (int j = 0; j < count; j++) {
                if(i==strs[j].length() || strs[0].charAt(i)!=strs[j].charAt(i)){
                    return strs[0].substring(0,i);
                }
            }
        }
        return strs[0];
    }
}
